package com.shide.flow.demo.config;

import com.shide.flow.demo.core.FlowContext;
import com.shide.flow.demo.engine.FlowEngine;
import com.shide.flow.demo.engine.FlowEngineImpl;
import com.shide.flow.demo.service.FlowProcessService;
import com.shide.flow.demo.service.impl.FlowProcessServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author yuwg
 */
@Configuration
public class FlowConfiguration {

    @Bean
    public FlowProcessService flowProcessService() {
        return new FlowProcessServiceImpl();
    }

    @Bean
    public FlowEngine flowEngine() {
        return new FlowEngineImpl();
    }


    @Bean
    public FlowContext flowContext(FlowProcessService flowProcessService, FlowEngine flowEngine) {

        FlowContext flowContext = new FlowContext();
        flowContext.setFlowProcessService(flowProcessService);


        return flowContext.build(flowEngine);

    }
}
